package me.zzp.provider;

import java.util.Map;

/**
 * @author zhangzepeng
 */
public class UserSqlProvider extends DynamicConditionProvider {

    @Override
    public String countBy(Map<String, Object> args) {
        return "select count(1) from users".concat(where(args));
    }

    @Override
    public String findBy(Map<String, Object> args) {
        return "select * from users".concat(where(args)).concat(paging(args));
    }

    @Override
    public String updateBy(Map<String, Object> args) {
        return "update users set name = #{user.name}, version = version + 1".concat(where(args));
    }

    @Override
    public String deleteBy(Map<String, Object> args) {
        return "delete from users".concat(where(args));
    }
}
